<?php include _include(APP_PATH.'view/htm/header.inc.htm');?>

<div class="row">
	<div class="col-lg-8 mx-auto">
	
		<?php include _include(APP_PATH.'view/htm/my_profile.inc.htm');?>
		
		<div class="card">
			<div class="card-header">
				<?php include _include(APP_PATH.'view/htm/my_nav.inc.htm');?>
			</div>
			<div class="card-body">
				<form action="<?php echo url('my-signature');?>" method="post" id="form">
					<div class="form-group input-group">
						<div class="input-group-prepend">
							<span class="input-group-text"><i class="icon-address-card-o"></i></span>
						</div>
						<input type="text" class="form-control" id="signature" name="signature" placeholder="<?php echo lang('please_signature');?>" value="<?php echo $user['signature']; ?>" required >
						<div class="invalid-feedback"><?php echo lang('please_signature');?></div>
					</div>
					<div>
						<button type="submit" class="btn btn-primary btn-block" id="submit" data-loading-text="<?php echo lang('submiting');?>..."><?php echo lang('update_signature');?></button>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>

<?php include _include(APP_PATH.'view/htm/footer.inc.htm');?>

<script>
var jform = $('#form');
var jsubmit = $('#submit');
jform.on('submit', function() {
	jform.reset();
	jsubmit.button('loading');
	var postdata = jform.serializeObject();
	$.xpost(jform.attr('action'), postdata, function(code, message) {
		if(code == 0) {
			$.alert(message);
			jsubmit.button(message).delay(3000).button('reset');
		} else if(code < 0) {
			$.alert(message);
			jsubmit.button('reset');
		} else {
			jform.find('[name="'+code+'"]').alert(message).focus();
			jsubmit.button('reset');
		}
	});
	return false;
});
</script>